/*
 * PingPPRestController.java
 * Copyright (c) 2014, 2019, Kiri. 
 * All rights reserved.
 */
package com.onesalt.web.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.onesalt.service.PingPPService;
import com.onesalt.utils.JSONUtil;
import com.pingplusplus.model.Charge;

/**
 * PingPP services
 *
 * @author kiri
 * @date 2015年5月17日
 * @version 1.0
 */
@RestController
public class PingPPRestController extends AbstractRestController {

	@Autowired
	private PingPPService pingPPService;

	public PingPPService getPingPPService() {
		return pingPPService;
	}
	
	@RequestMapping(value = "/3rd/pingpp", method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.TEXT_PLAIN_VALUE })
	public String receiveNotification(@RequestBody Charge charge) {
		getLogService().log(JSONUtil.toJsonString(charge));
		return "success";
	}
}
